theme: Compute scale values once
authorBenjamin Otte <otte@redhat.com>
Sat, 5 Mar 2011 13:49:19 +0000 (14:49 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 5 Mar 2011 14:03:56 +0000 (15:03 +0100)
Use a local variable to store the xscale and yscale, so that it's only
computed once.
Makes it easier to do the changes I'm about to do.

gtk/gtkthemingengine.c

index bd32c906a05ece38afe9ddc514038fd69e3d5168..2fdec7335a01f75e76ff5eb37039895171dd99a6 100644 (file)
@@ -3005,6 +3005,8 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
           /* transparency is a function of time and intial value */
           gdouble t = (gdouble) ((i + num_steps - step)
                                  % num_steps) / num_steps;
+          gdouble xscale = cos (i * G_PI / half);
+          gdouble yscale = sin (i * G_PI / half);
 
           cairo_set_source_rgba (cr,
                                  color->red,
@@ -3013,11 +3015,11 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
                                  color->alpha * t);
 
           cairo_move_to (cr,
-                         (radius - inset) * cos (i * G_PI / half),
-                         (radius - inset) * sin (i * G_PI / half));
+                         (radius - inset) * xscale,
+                         (radius - inset) * yscale);
           cairo_line_to (cr,
-                         radius * cos (i * G_PI / half),
-                         radius * sin (i * G_PI / half));
+                         radius * xscale,
+                         radius * yscale);
           cairo_stroke (cr);
         }